import { defineStore } from "pinia";
const LOCAL_USER_ROLE = "current_user_Identity";
export enum roleType {
  Administrator, // 管理员
  Experimenter, // 实验员
  Teacher, // 教师
  Student, // 学生
  NotLogin, // 没有登陆
}
const userRole = defineStore("role", {
  state: () => {
    return {
      identity: roleType.NotLogin,
    };
  },
  actions: {
    changeRole(val: roleType) {
      // 角色身份默认存储在localStorage里面
      this.identity = val;
      localStorage.setItem(LOCAL_USER_ROLE, String(val));
    },
  },
});
export default userRole;
